/**
 * Created by zlw on 2017/9/7.
 */
// var gulp      = require('gulp');
// var rename    = require('gulp-rename');
// var VueParser = require('gulp-vue-parser');
//
// gulp.task('vue', function() {
//   return gulp.src('./src/components/*.vue')
//     .pipe(VueParser({
//       defaultStyleLang:"sass"
//     }))
//     .pipe(rename({extname : ".js"}))
//     .pipe(gulp.dest("./dist1"));
// });
//
// gulp.task('default', ['vue']);

/**
 * Created by zhangliuwen on 2017/5/30.
 */
const gulp = require("gulp");
const uglify = require("gulp-uglify");
const rename = require('gulp-rename');
const babel = require("gulp-babel");
// const concat = require('gulp-concat');

// gulp.task("js0", function () {
//   return gulp.src("./src/ajax/*.js")
//     .pipe(babel({presets:["es2015"]}))
//     .pipe(rename({extname : ".min.js"}))
//     .pipe(uglify())
//     .pipe(gulp.dest("./src/ajax"));
// });
//
// gulp.task("js1", function () {
//   return gulp.src("./src/mixins/*.js")
//     .pipe(babel({presets:["es2015"]}))
//     .pipe(rename({extname : ".min.js"}))
//     .pipe(uglify())
//     .pipe(gulp.dest("./src/mixins"));
// });

// gulp.task("store", function () {
//   return gulp.src(["./src/core/store/actions.js", "./src/core/mixins/mutation-types.js", "./src/core/store/mutations.js"])
//   // .pipe(babel({presets:["es2015"]}))
//     .pipe(concat("index.js"))
//     // .pipe(uglify())
//     .pipe(gulp.dest("./src/core/store"));
// });

gulp.task("ajax", function () {
  return gulp.src("./src/core/ajax/*.js")
    .pipe(babel({presets:["es2015"]}))
    .pipe(rename({extname : ".min.js"}))
    .pipe(uglify())
    .pipe(gulp.dest("./src/core/ajax"));
});

gulp.task("mixins", function () {
  return gulp.src("./src/core/mixins/*.js")
    .pipe(babel({presets:["es2015"]}))
    .pipe(rename({extname : ".min.js"}))
    .pipe(uglify())
    .pipe(gulp.dest("./src/core/mixins"));
});

gulp.task("store", function () {
  return gulp.src("./src/core/store/*.js")
    .pipe(babel({presets:["es2015"]}))
    .pipe(rename({extname : ".min.js"}))
    .pipe(uglify())
    .pipe(gulp.dest("./src/core/store"));
});

gulp.task("default", ["ajax", "mixins", "store"]);


